using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Srvtools;

public partial class WSingle_WSingle : System.Web.UI.Page
{
    private Srvtools.WebDataSet WMaster;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitializeComponent();
            String CarId = Request.QueryString["UseCarId"];
            WMaster.SetWhere("UseCarId=" + CarId);
            Master.DataSource = WMaster;
            Master.DataBind();

            String SEd = Request.QueryString["Ed"];
            if (SEd == string.Empty || (SEd == null)) SEd = "";
            if (SEd == "1") WebNavigator1.Visible   = true;

            String str = Request.QueryString["VW"];
            if (str == string.Empty || (str == null)) str = "";
            if (str.Length == 0 || str == "1")
            {
                Button1.Attributes.Add("onclick", "javascript:window.close();");
              }
            else
            {
               Button1.Attributes.Add("onclick", "javascript:window.close();window.opener.document.location='UseCarList2.aspx';");
            }
        }
    }

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WSingle_WSingle));
        this.WMaster = new Srvtools.WebDataSet();
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).BeginInit();
        // 
        // WMaster
        // 
        this.WMaster.Active = true;
        this.WMaster.AlwaysClose = false;
        this.WMaster.DeleteIncomplete = true;
        this.WMaster.Guid = null;
        this.WMaster.LastKeyValues = null;
        this.WMaster.Locale = new System.Globalization.CultureInfo("zh-CN");
        this.WMaster.PacketRecords = 100;
        this.WMaster.Position = -1;
        this.WMaster.RemoteName = "ServiceSheet.Services_UseCars";
        this.WMaster.ServerModify = false;
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).EndInit();

    }
         
    protected void WebNavigator1_BeforeCommand(object sender, BeforeCommandArgs e)
    {
        if (e.CommandName == "cmdApply")
        {
            BaseText.ZLTextBox tbSCLM = (BaseText.ZLTextBox)this.wfvMaster.FindControl("tbSCLM");
            BaseText.ZLTextBox tbXCLM = (BaseText.ZLTextBox)this.wfvMaster.FindControl("tbXCLM");
            BaseText.ZLTextBox tbGLS = (BaseText.ZLTextBox)this.wfvMaster.FindControl("tbUseKil");
            if ((tbXCLM.Text.Trim().Length != 0) && (tbSCLM.Text.Trim().Length != 0))
            {
                int UseKil = int.Parse(tbXCLM.Text) - int.Parse(tbSCLM.Text);
                tbGLS.Text = UseKil.ToString();
            }
            else
            {
                tbGLS.Text = "";
            }
        }
    }

 
}
